import { message, Modal } from 'antd';
import { useImperativeHandle, useState, type Ref } from 'react';

interface Props {
  innerRef: Ref<{showModal: (params: any) => void} | undefined>;
}
const InfoModal = (props: Props) => {
  const [modalVisible, setModalVisible] = useState(false);
  useImperativeHandle(props.innerRef, () => ({
    showModal
  }))

  const showModal = (params: any) => {
    console.log(params, 'showModal')
    setModalVisible(true);
  }

  const handleOk = () => {
    setModalVisible(false);
    message.success('修改用户信息成功');
  }

  const handleCancel = () => {
    setModalVisible(false);
  }

  return (
    <Modal title='个人信息' open={modalVisible} onOk={handleOk} onCancel={handleCancel} destroyOnHidden={true}>
      <p>个人信息</p>
      <p>个人信息</p>
      <p>个人信息</p>
    </Modal>
  )
}

export default InfoModal;